package com.wsjj.yjh.server.impl;

import com.wsjj.yjh.bean.ZookeeperTable;
import com.wsjj.yjh.mapper.ZookeeperMapper;
import com.wsjj.yjh.server.ZookeeperTableServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Random;

@Service
public class ZookeeperTableServerImpl implements ZookeeperTableServer {

    @Autowired
    ZookeeperMapper zookeeperMapper;

    @Override
    public ZookeeperTable selectById() {
        Integer coumt = zookeeperMapper.selectCoumt();
        Random random = new Random();
        int id = random.nextInt(coumt);

        return zookeeperMapper.selectById(id+1);
    }
}
